php uses $_ POST or $_ SESSION [] to pass parameters to the js function

  • 2021-07-18 07:40:38
  • OfStack

In php programming, parameters can be passed to js functions using $_ POST, $_ SESSION [''], or echo statements for output


<?php
echo "<script>test('$_POST[userid]');</script> ";
?>

The $_ POST [''] above also applies to $_ SESSION [''];

<?php
$para = "hello boby!";
echo $para; // www.ofstack.com
echo "<script> var para=\"$para\"; alert(para);</script>";
?>


Related articles: